{include app:admin.inc.header}
<!--tmpl-resource-->
{include app:admin.inc.top}
<style>
	.drop-area {
		width: 162px;
		height: 180px;
		padding: 0px;
		border: 1px dashed silver;
		color: #aaa;
		text-align: center;
		border-radius: 1px;
		background-repeat: no-repeat;
		background-position: center center;
		background-color: #efefef;
		cursor: pointer;
		/*overflow: scroll;
        overflow: auto;
        overflow-x: hidden;*/
	}
	.drop-area img {
		width: 160px;
		height: 177px;

	}

</style>

<div class="container-fluid content-body">
	<div class="main">
		<!-- left side start-->
		{include admin.inc.menu}
		<!-- left side end-->


		<!-- main content start-->
		<section class="right-section" id="right-section">
			<!-- start of inner-frame -->
			<div class="inner-iframe">

				<!-- page breadcrumb start-->
				{include admin.inc.bread}
				<!-- page "breadcrumb end-->
				<!-- Nav tabs -->
				<ul class="nav nav-tabs">

					<li {if $id==''}class="active"{/if}><a {if $id==''}href="javascript:void(0);"{else}href="{$add_url}"{/if}><i class="glyphicon glyphicon-plus"></i> 添加友情链接</a></li>
					<li><a href="{$index_url}" ><i class="glyphicon glyphicon-th-list"></i> 友情链接列表</a></li>
					{if $id != ''}<li class="active"><a href="javascript:void(0);"><i class="glyphicon glyphicon-edit"></i> 编辑友情链接</a></li>{/if}
					<li ><a href="{url /admin/friendLinkCate/index}"><i class="glyphicon glyphicon-th-list"></i> 分类列表</a></li>

				</ul>
				<div class="inner-container">
					<form role="form" class="content-add-form form-horizontal" id="content-add-form" autocomplete="off">
						<!--tmpl-fields-->
						<!-- input -->
						<div class="form-group">
							<label class="col-sm-2 control-label">
								<span class="asterisk">*</span>
								标题 
							</label>
							<div class="col-sm-6">
								<input  dtype="" class="form-control" maxlength="20" name="data[title]" placeholder="标题" required cname="标题" value="{$item[title]}" />
								<p class="help-block"></p>
							</div>
							<div class="col-sm-2">
								字符长度为20字以内
							</div>
						</div>
						
						<!-- select -->
						<div class="form-group">
							<label class="col-sm-2 control-label">
								<span class="asterisk">*</span>
								分类
							</label>
							<div class="col-sm-4">
							<select required class="form-control m-bot15 " id="inputcatid" name="data[catid]">
								<!--<option value="0">-- 请选择 --</option>-->
								<!-- selectoptions -->
								{loop $catidoptions $v}
								<option {if $item[catid] == $v[id]}selected{/if} value="{$v[id]}">{$v[name]}</option>
								{/loop}
							</select>
							</div>
						</div>
						<p class="help-block"></p>
						
						<!-- input -->
						<div class="form-group">
							<label class="col-sm-2 control-label">
								<span class="asterisk">*</span>
								网址 
							</label>
							<div class="col-sm-6">
								<input  dtype="url" class="form-control" maxlength="255" name="data[url]" placeholder="网址" required cname="网址" value="{$item[url]}" />
								<p class="help-block"></p>
							</div>
						</div>

						
						<!-- image -->
						<div class="form-group">
							<label class="col-sm-2 control-label">LOGO</label>
							<div class="col-sm-4">

								<div id="drop-area" class="drop-area">
									{if $item[logo]!=''}
									<img src="{$item[logo]}">
									{else}
									<span style="margin-top: 40%;display: block;">照片最佳尺寸169*177<br/>大小不能超过1M</span>

									{/if}
								</div>
								<input id="files-upload" type="file" name="photo" data-name="照片"/>

								<input type="hidden" name="data[logo]" value="{$item[logo]}">
							</div>

						</div>
						
						<!-- select -->
						<div class="form-group">
							<label class="col-sm-2 control-label">类型</label>
							<div class="col-sm-4">
							<select class="form-control m-bot15 " id="inputtype" name="data[type]">
								<!--<option value="0">文字</option>-->
								<option value="1">图片</option>
							</select>
							</div>
						</div>
						<p class="help-block"></p>
						
						<!-- input -->
						<div class="form-group">
							<label class="col-sm-2 control-label">
								<span class="asterisk">*</span>
								排序 
							</label>
							<div class="col-sm-4">
								<input  dtype="number" class="form-control" maxlength="{maxlength}" name="data[listorder]" placeholder="排序" required cname="排序" value="{if $item[listorder]}{$item[listorder]}{else}0{/if}" />
							</div>
							<div class="col-sm-4">
								*排序由小到大排序，数字越小，排的越前*
							</div>
						</div>
						<p class="help-block"></p>
						
						<!-- switch -->
						<div class="form-group">
							<label class="col-sm-2 col-sm-2 control-label">状态</label>
							<div class="col-sm-4">
								<input type="checkbox" id="switch-status" name="data[status]" class="bswitch" data-size="normal" {if $item[status]}checked{/if} data-on-text="启用" data-off-text="禁用">
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-2 col-sm-2 control-label">操作人</label>
							<div class="col-sm-4" style="padding-top: 3px;">{$admin_name}</div>
						</div>

						<!--tmpl-assocfields-->
						<div class="btn-group btn-group-or">
							<a href="{if $id==''}{$do_add_url}{else}{$do_edit_url}?id={$id}{/if}" class="btn btn-primary ajaxproxy"
								proxy='{"method":"post", "location":"{$index_url}"}'>提交保存</a>

						</div>
					</form><!-- content add form -->
				</div>
			</div><!-- end of inner -->
		</section>
	</div>
</div>
{include admin.inc.footer}

<!--tmpl-script-->

<!-- pagescript -->
<script type="text/javascript">
	seajs.use("admin/setting_friendlinkadd",function (parameter){
		
		/**--tmpl-templatejavascript--**/
		
		<!--tmpl-templatejavascript-->
		parameter.upload_url="{$upload_url}";
		parameter.image_search_url="{$image_search_url}";
		parameter.image_list_url="{$image_list_url}";
		
		parameter.init();		

	});
</script>


<script id="assocpage" type="text/html">
<div class="text-right">
	<ul class="pagination blog-pagination">
		<li><a class="assoc-page" data-page="{[prev]}" href="javascript:void(0);">上一页</a></li> 
		{[loop pages page]}

		<li ><a class="assoc-page" data-page="{[page]}" {[if curr == page]}class="active"{[/if]} href="javascript:void(0)">{[page]}</a></li> 

		{[/loop]}
		<li><a class="assoc-page" href="javascript:void(0);" data-page="{[nexts]}">下一页</a></li> 
	</ul>	
</div>
</script>

</body>
</html>
